<!doctype html>
<html lang="en">
<head>
    <title>Carousel - Dynamic Content</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="Overview" />
    <meta name="keywords" content="" />
    <meta name="author" content="ComponentOne" />
    <link href="../../themes/rocket/jquery-wijmo.css" rel="stylesheet" type="text/css" />
    <link href="../../themes/wijmo/jquery.wijmo-open.2.3.2.css" rel="stylesheet" type="text/css" />
    <link href="../../themes/wijmo/jquery.wijmo.wijtree.css" rel="stylesheet" type="text/css" />
    <script src="../../external/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="../../external/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>
    <script src="../../external/jquery.wijmo-open.all.2.3.2.min.js" type="text/javascript"></script>
    <link href="../../themes/wijmo/jquery.wijmo.wijcarousel.css" rel="stylesheet" type="text/css" />
    <script src="../../wijmo/jquery.wijmo.wijcarousel.js" type="text/javascript"></script>
    <link href="../../themes/wijmo/jquery.wijmo.wijpager.css" rel="stylesheet" type="text/css" />
    <script src="../../wijmo/jquery.wijmo.wijpager.js" type="text/javascript"></script>
    <style type="text/css">
        #wijcarousel0
        {
            width: 300px;
            height: 75px;
        }
        #wijcarousel1
        {
            width: 750px;
            height: 300px;
        }
    </style>
    <script id="scriptInit" type="text/javascript">
        $(document).ready(function () {
            var images = [
            {
                imageUrl: "http://lorempixum.com/750/300/abstract/1",
                linkUrl: "http://lorempixum.com/750/300/abstract/1",
                content: "",
                caption: "<span>Word Caption 1</span>"
            },
            {
                imageUrl: "http://lorempixum.com/750/300/abstract/2",
                linkUrl: "http://lorempixum.com/750/300/abstract/2",
                content: "",
                caption: "<span>Word Caption 2</span>"
            },
            {
                imageUrl: "http://lorempixum.com/750/300/abstract/3",
                linkUrl: "http://lorempixum.com/750/300/abstract/3",
                content: "",
                caption: "<span>Word Caption 3</span>"
            },
            {
                imageUrl: "http://lorempixum.com/750/300/abstract/4",
                linkUrl: "http://lorempixum.com/750/300/abstract/4",
                content: "",
                caption: "<span>Word Caption 4</span>"
            },
            {
                imageUrl: "http://lorempixum.com/750/300/abstract/5",
                linkUrl: "http://lorempixum.com/750/300/abstract/5",
                content: "",
                caption: "<span>Word Caption 5</span>"
            }
            ];
            $("#wijcarousel1").wijcarousel({
                display: 1,
                step: 1,
                showTimer: false,
                data: images
            });

            $("#wijcarousel0").wijcarousel({
                display: 4,
                step: 3,
                showTimer: false,
                loadCallback: function () {
                    $.get("../Widgets/Wijmo-Complete/development-bundle/samples/carousel/ajax.txt", function (self, status, data) {
                        ajaxCallback(data.responseText);
                    });
                }
            });

            function ajaxCallback(images) {
                var imgs = images.split('|'), data = [];
                for (i = 0; i < imgs.length; i++) {
                    data[i] = {
                        imageUrl: imgs[i],
                        linkUrl: "",
                        content: "",
                        caption: "<span>Image " + (i + 1) + "</span>"
                    }
                }
                $("#wijcarousel0").wijcarousel("option",
                    "data",
                     data);
            }
        });
    </script>
</head>
<body class="demo-single">
    <div class="container">
        <div class="header">
            <h2>
                Ajax</h2>
        </div>
        <div class="main demo">
            <!-- Begin demo markup -->
            <div>
                <h3>
                    Load data from data array
                </h3>
                <div id="wijcarousel1">
                </div>
                <br />
                <h3>
                    Load data from ajax.
                </h3>
                <div id="wijcarousel0">
                </div>
            </div>
            <!-- End demo markup -->
            <div class="demo-options">
                <!-- Begin options markup -->
                <!-- End options markup -->
            </div>
        </div>
        <div class="footer demo-description">
            <p>
                This sample demonstrates how data can be loaded into the wijcarousel using Ajax.
            </p>
        </div>
    </div>
</body>
</html>
